﻿@{
    ViewBag.Title = "Manage";
    Layout = "~/Views/Shared/_Layout.cshtml";
    List<User> userList = ViewBag.Users;
}
@section scripts
{
    @Scripts.Render("~/Scripts/Models/AccountManage.js")
    <script>
        //$(document).ready(function () {
        //    $("#CusType").validate();
        //});invisible
    </script>
}
@if (ViewBag.Msg != null)
{ 
    @ViewBag.Msg
}
<br />
@if (ViewBag.Error != null)
{ 
    <div class="alert alert-error">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        <h4>Error!</h4>
        @ViewBag.Error
    </div>    
}

@if (ViewBag.MsgSuccess != null)
{ 
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        <h4></h4>
        @ViewBag.MsgSuccess

    </div>    
}
<div id="CreateUser">

</div>
<div id="ManageUser" class="">
    <h2>Manage User Account</h2>    

    <button class="btn" onclick="AddNewUser('','0','New Customer Type')">Add New User</button>
    <br />
    <br />
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>User ID
                </th>
                <th>User Name
                </th>
                <th>Email
                </th>
                <th>Edit
                </th>
                <th>Delete
                </th>
            </tr>
            @foreach (var item in userList)
            {
                <tr>
                    <td>@item.UserId</td>
                    <td>
                        @item.Username
                    </td>
                    <td>
                        @item.Email
                    </td>
                    <td>
                        <a href="#" onclick="AddCustomerType('@item.UserId' , '@item.Username.ToString()','Edit Customer Type')" class="btn btn-primary">Edit</a>
                    </td>
                    <td>
                        <a href="#" class="btn btn-danger" onclick="DeleteCustomerType('@item.Username.ToString()')">Delete</a>
                    </td>
                </tr>
            }
        </thead>
    </table>
</div>


<div id="ConfirmDelete">
</div>
<div id="InactivateUser">
</div>
